﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Web;

namespace Zhongchouwwwww.BAL
{
    public class DataVerification
    {
        /// <summary>
        /// 验证是否是手机号
        /// </summary>
        /// <param name="Phone"></param>
        /// <returns></returns>
        public static bool IsHandset(string Phone)
        {
            return Regex.IsMatch(Phone, @"^[1]+[3,4,5,8]+\d{9}");
        }
        
        /// <summary>
        /// 验证是否为16位的数字
        /// </summary>
        /// <param name="BankNum"></param>
        /// <returns></returns>
        public static bool IsBankNum(string BankNum)
        {
            return Regex.IsMatch(BankNum, @"^(\d{16})$");
        }

        public static bool IsPostNum(string PostNum)
        {
            return Regex.IsMatch(PostNum, @"^(\d{6})$");
        }

        /// <summary>
        /// 验证是否为汉字
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public static bool IsChinese(string name)
        {
            return Regex.IsMatch(name, "^[\u4e00-\u9fa5]{0,}$");
        }

        /// <summary>
        /// 检测是否登录 false是未登录状态  true是登录状态
        /// </summary>
        /// <returns></returns>
        public static bool IsSignin()
        {
            if (0 == Config.Config.ThisUser.UserId)
            {
                return false;
            }
            else
            {
                return true;
            }
        }

    }
}